import { http } from "@/utils"

export interface ResType<T> {
    message: string,
    data: T
}
export interface ChannelItem {
    id: number,
    name: string
}
interface ChannleRes {
    channels: ChannelItem[]
}

export function fetchChannleApi() {
    return http.request<ResType<ChannleRes>>({
        url: "/channels"
    })
}
export interface ListItem{
    art_id: string,
    title: string,
    aut_id: string,
    comm_count: number,
    pubdate: number,
    aut_name: string,
    is_top: number,
    cover:{
        type: number,
        images: string[]
    }
}
export interface ListRes {
    pre_timestamp: string ,
    results: ListItem[]
}
export interface ReqParams {
    channel_id: string,
    timestamp: string 
}
export function fetchListApi(params:ReqParams) {
    return http.request<ResType<ListRes>>({
        url: "/articles",
        params
    })
}
